Open
Conversation
added 7 commits
March 5, 2026 07:23
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #445 +/- ##
==========================================
+ Coverage 76.24% 76.39% +0.14%
==========================================
Files 53 53
Lines 9322 9362 +40
==========================================
+ Hits 7108 7152 +44
+ Misses 2214 2210 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
43d0026 to
75691a8
Compare
75691a8 to
c7365b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a rewrite of
VMCollection.Requires #438
Goals:
Main changes:
Improved docstring
VMCollectionis actually a fairly counter-intuitive object. It's not a true collection (as a dict or set or Mapping) since it holds two different collections - one for thevm.Listcache and one containing blind objects - but depending on the method called one or the other may be used.The new docstring aims to fairly convey that.
Better variable names
Previous variables names did not properly convey what the variables did.
Rewrite of the
vm_objects/vm_dictsplitThe new code uses
vms/known_namesinstead, which 1) is clearer 2) allows for simpler logic in e.g.get_blind()Minor changes:
Split and renamed
refresh_cacheThe old
refresh_cacheby default did not refresh the cache (force=False). It has been split into_ensure_cache_loaded(=force=False) andrefresh_cache(=force=True).More direct vm access in
__iter__,valuesSince we already call
_ensure_cache_loadedat the start of the method, we can useget_blindto avoidself._vms[name] > __getitem__ > __contains __ > get_blindRemove
app.cache_enabledlogicThe
VMCollectionshould not have to interact withapp.cache_enabled, this should be internal toapp. In other words, even if we pass apower_state=in__init__, ifcache_enabled=False, then theappobject should not used the passed value.Looking at
QubeBase's code, this is already the case:_power_state_cacheis only not-Noneifcache_enabled=True- so in practice this should not change any behavior, only cleanup the code.Note (see test
test_101_list_selected): this "fixes" the fact that callingqvm-lson a selected subset of VMs callsadmin.vm.CurrentStateeven though this data is already returned byadmin.vm.List. If I understand correctly this behavior was due to the fact that whenArgParserfetches a subset of VMs, it creates a newappobject which by default has cache disabled, before the calling method can itself enable the cache.